#include <iostream>
using namespace std;

typedef struct BinaryTreeNode
{
	BinaryTreeNode* left;
	BinaryTreeNode* right;
	int data;
}BTNode;
void PrevOdrer(BinaryTreeNode* root)
{
	if (root == NULL)
	{
		cout << "NULL" << " ";
		return;
	}
	cout << root->data << " ";
	PrevOdrer(root->left);
	PrevOdrer(root->right);
}

void InOrder(BinaryTreeNode* root)
{
	if (root == NULL)
	{
		cout << "NULL" << " ";
		return;
	}
	InOrder(root->left);
	cout << root->data << " ";
	InOrder(root->right);
}

void PostOrder(BTNode* root)
{
	if (root == NULL)
	{
		cout << "NULL" << " ";
		return;
	}
	PostOrder(root->left);
	PostOrder(root->right);
	cout << root->data << " ";
}


int TreeLeafSize(BTNode* root)
{
	if (root == NULL)
	{
		return 0;
	}
	if (root->left == NULL && root->left == NULL)
	{
		return 1;
	}
	return TreeLeafSize(root->left) + TreeLeafSize(root->right);
}


int MaxDeep(BTNode* root)
{
	if (root == NULL)
	{
		return 0;
	}
	int LeftDeep = MaxDeep(root->left);
	int RightDeep = MaxDeep(root->right);
	return LeftDeep > RightDeep ? LeftDeep + 1 : RightDeep + 1;
}

void TreeSize(BTNode* root, int* size)
{
	if (root == NULL)
	{
		return;
	}
	else
	{
		(*size)++;
	}
	TreeSize(root->left, size);
	TreeSize(root->right, size);
}